<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Error handling</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="sca.examples.structures.html">Working with Data Structures</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ref.sca.html">SCA 函数</a></div>
 <div class="up"><a href="sca.examples.html">范例</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="sca.examples.errorhandling" class="section">
  <h2 class="title"> Error handling </h2>
  <p class="para"> 
   This section describes how errors are handled. There are two
   types of errors:
  </p>
  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para"> 
     SCA runtime exceptions are those that signal problems in
     the management of the execution of components, and in the
     interaction with remote services. These might occur due to
     network or configuration problems.
    </p>
   </li>
   
   <li class="listitem">
    <p class="para"> 
     Business exceptions are those that are defined by the
     programmer. They extend the PHP Exception class, and are thrown
     and caught deliberately as part of the business logic. 
    </p>
   </li>
   
  </ul>
  
  <div class="section" id="sca.examples.errorhandling.runtime">
   <h2 class="title"> Handling of Runtime exceptions </h2>
   <p class="para"> 
    There are two types of SCA runtime exception: 
   </p>
   
   <ul class="itemizedlist">
    <li class="listitem">
     <p class="para"> 
      SCA_RuntimeException - signals a problem found by or
      perhaps occurring within the SCA runtime. This can be thrown for
      a variety of reasons, many of which can occur regardless of
      whether a connection is being made to a local or a remote service:
      an error in one of the annotations within a component, a missing
      WSDL or php file, and so on. In the case of Web services, an
      SCA_RuntimeException can also be thrown if a SoapFault is
      received from a remote Web service and the fault code in the
      SoapFault indicates that a retry is unlikely to be successful.
     </p>
    </li>
    
    <li class="listitem">
     <p class="para"> 
      SCA_ServiceUnavailableException - this is a subclass of
      SCA_RuntimeException and signals a problem in connecting to or
      using a remote service, but one which might succeed if retried.
      In the case of Web services, this exception is thrown if a
      SoapFault is received with a fault code that indicates that a
      retry might be successful. 
     </p>
    </li>
    
   </ul>
  </div>
  
  <div class="section" id="sca.examples.errorhandlilng.business"> 
   <h2 class="title"> Handling of Business exceptions </h2>
   <p class="para"> 
    Business exceptions may be defined and thrown by a component
    in the normal way, regardless of whether the component has been
    called locally or remotely. The SCA runtime does not catch
    business exceptions that have been thrown by a component called
    locally, so they will be returned to a caller in the normal way. If a
    component has been called via a Web service, on the other hand, the
    SCA runtime on the service providing end does catch business
    exceptions, and will ensure these are passed back to the calling
    end and re-thrown. Assuming that the calling end has a definition
    of the exception (that is, is able to include a file containing the
    PHP class defining the exception) the re-thrown exception will
    contain the same details as the original, so that the
    <span class="function"><strong>getLine()</strong></span> and
    <span class="function"><strong>getFile()</strong></span> methods for example will contain
    the location where the exception was thrown within the business
    logic. The exception will be passed in the detail field of a soap
    fault with a fault code of &quot;Client&quot;. 
   </p>
  </div>
  
    
 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="sca.examples.structures.html">Working with Data Structures</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ref.sca.html">SCA 函数</a></div>
 <div class="up"><a href="sca.examples.html">范例</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
